package moon.core.entity;

import moon.core.Name;
import moon.core.classdef.MethDec;
import moon.core.classdef.Type;

/**
 * Function.
 * 
 * @author <a href="mailto:rmartico@ubu.es">Ra&uacute;l Marticorena</a>
 *
 */
@SuppressWarnings("serial")
public abstract class FunctionDec extends MethDec {

	/**
	 * Constructor.
	 * 
	 * @param name name of the function
	 * @param returnType return type
	 */
	public FunctionDec(Name name, Type returnType) {
		super(name);    	
		this.setFunctionResultEntity(returnType);
	}
    
    /**
     * Gets the return type.
     * 
     * @return return type
     * @see #setFunctionResultEntity
     */
    public Type getReturnType(){
    	return this.getFunctionResultEntity().getType();
    }
    
    /**
     * Gets the result entity of the function.
     * 
     * @return result entity
     * @see #setFunctionResultEntity
     * 
     */
    public abstract Result getFunctionResultEntity();
    
    /**
     * Sets the result entity of the function.
     * 
     * @param type type
     * @see #getFunctionResultEntity
     */
    public abstract void setFunctionResultEntity(Type type);

    /**
     * {@inheritDoc}.
     * 
     * @return {@inheritDoc}
     */
    @Override
    public boolean hasReturnType(){
    	return true;
    }
    
} // FunctionDec
